package pe.com.cotelasa.scp.entidad;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
 
@Entity
@Table(name = "pais",catalog = "bdcotelasa", schema = "cotelasa")
@Cache(usage= CacheConcurrencyStrategy.READ_ONLY)
@NamedQueries({
    @NamedQuery(name = "Pais.findAll", query = "SELECT p FROM Pais p"),
    @NamedQuery(name = "Pais.findById", query = "SELECT p FROM Pais p WHERE p.id = :id"),
    @NamedQuery(name = "Pais.findByNombre", query = "SELECT p FROM Pais p WHERE p.nombre = :nombre"),
    @NamedQuery(name = "Pais.findByEstadoRegistro", query = "SELECT p FROM Pais p WHERE p.estadoRegistro = :estadoRegistro"),
    @NamedQuery(name = "Pais.findByUsrCreacion", query = "SELECT p FROM Pais p WHERE p.usrCreacion = :usrCreacion"),
    @NamedQuery(name = "Pais.findByFecCreacion", query = "SELECT p FROM Pais p WHERE p.fecCreacion = :fecCreacion"),
    @NamedQuery(name = "Pais.findByUsrModificacion", query = "SELECT p FROM Pais p WHERE p.usrModificacion = :usrModificacion"),
    @NamedQuery(name = "Pais.findByFecModificacion", query = "SELECT p FROM Pais p WHERE p.fecModificacion = :fecModificacion")})
public class Pais implements Serializable {
 
    private static final long serialVersionUID = -7181288440158127419L;

    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    
    @Basic(optional = false)
    @Column(name = "nombre")
    private String nombre;
    
    @Basic(optional = false)
    @Column(name = "estado_registro")
    private char estadoRegistro;
    
    @Basic(optional = false)
    @Column(name = "usr_creacion")
    private String usrCreacion;
    
    @Column(name = "usr_modificacion")
    private String usrModificacion;
    
    @Basic(optional = false)
    @Column(name = "fec_creacion")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecCreacion;
    
    @Column(name = "fec_modificacion")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecModificacion;
 
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idPais", fetch = FetchType.LAZY)
    private Collection<Ubigeo> ubigeoCollection;
    
    public Pais() {
    }

    public Pais(Integer id) {
        this.id = id;
    }

    public Pais(Integer id, String nombre, char estadoRegistro, String usrCreacion, Date fecCreacion) {
        this.id = id;
        this.nombre = nombre;
        this.estadoRegistro = estadoRegistro;
        this.usrCreacion = usrCreacion;
        this.fecCreacion = fecCreacion;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public char getEstadoRegistro() {
        return estadoRegistro;
    }

    public void setEstadoRegistro(char estadoRegistro) {
        this.estadoRegistro = estadoRegistro;
    }

    public String getUsrCreacion() {
        return usrCreacion;
    }

    public void setUsrCreacion(String usrCreacion) {
        this.usrCreacion = usrCreacion;
    }

    public Date getFecCreacion() {
        return fecCreacion;
    }

    public void setFecCreacion(Date fecCreacion) {
        this.fecCreacion = fecCreacion;
    }

    public String getUsrModificacion() {
        return usrModificacion;
    }

    public void setUsrModificacion(String usrModificacion) {
        this.usrModificacion = usrModificacion;
    }

    public Date getFecModificacion() {
        return fecModificacion;
    }

    public void setFecModificacion(Date fecModificacion) {
        this.fecModificacion = fecModificacion;
    }

    public Collection<Ubigeo> getUbigeoCollection() {
        return ubigeoCollection;
    }

    public void setUbigeoCollection(Collection<Ubigeo> ubigeoCollection) {
        this.ubigeoCollection = ubigeoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pais)) {
            return false;
        }
        Pais other = (Pais) object;
        if ((this.id == null && other.id != null) || (this.id != null && this.id.intValue()!=other.id.intValue())) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.com.cotelasa.scp.entidad.Pais[ id=" + id + " ]";
    }
    
}
